package com.example.controller.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.pojo.Process;
import com.example.pojo.ProcessNode;
import com.example.service.IProcessNodeService;
import com.example.service.IProcessService;
import com.example.vo.ResultVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;

import javax.websocket.server.PathParam;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * 流程节点表 前端控制器
 * </p>
 *
 * @author wsl
 * @since 2022-04-11
 */
@RestController
@RequestMapping("/sys/process-node")
@Api(tags = "流程节点管理",value = "")
public class ProcessNodeController {

    @Autowired
    private IProcessNodeService processNodeService;

    @ApiOperation(value = "查询流程节点")
    @GetMapping("/query")
    public ResultVo getProcessNodesByProId(@RequestParam Integer processId){
        return processNodeService.getProNodesByProId(processId);
    }

    @ApiOperation(value = "新增流程节点")
    @PostMapping("/edit")
    public ResultVo addProcessNodes(@RequestBody Process process){
        return processNodeService.addProcessNodes(process);
    }

//    @ApiOperation(value = "修改流程节点")
//    @PutMapping("")
//    public ResultVo updateProcess(@RequestBody ProcessNode processNode){
//        if(processNodeService.updateById(processNode)){
//            return ResultVo.ok("修改成功");
//        }
//        return ResultVo.error("修改失败!");
//    }
//
//    @ApiOperation(value = "删除流程节点")
//    @DeleteMapping("/delete")
//    public ResultVo deleteProcess(Integer[] ids){
//        if(processNodeService.removeByIds(Arrays.asList(ids))){
//            return ResultVo.ok("删除成功");
//        }
//        return ResultVo.error("删除失败!");
//    }
}
